home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Video Toaster 4.0
/
Video Toaster v4.0.iso
/
arexx
/
modeler
/
explode.lwm
< prev
next >
Wrap
Text File
|
1993-12-13
|
2KB
|
105 lines
/* CMD: Explode Points
* Transform points algorithmically: Explode from center
* By Arnie Cachelin © 1993 NewTek Inc.
*/
libadd = addlib("LWModelerARexx.port",0)
signal on error
signal on syntax
call addlib "rexxsupport.library", 0, -30, 0
MATHLIB="rexxmathlib.library"
IF POS(MATHLIB , SHOW('L')) = 0 THEN
IF ~ADDLIB(MATHLIB , 0 , -30 , 0) THEN DO
call notify(1,"!Can't find "MATHLIB)
exit
END
type=1
rate=90
rmax=1
cx=0
cy=0
cz=0
version = 'Explode v1.0'
filnam = 'ENV:Explode.state'
if (exists(filnam)) then do
if (~open(state, filnam, 'R')) then break
if (readln(state) ~= version) then break
parse value readln(state) with rate cx cy cz rmax type .
call close state
end
call req_begin "Explode Points"
id_txt = req_addcontrol("Scale radial position", 'T',"of points inside Effect Radius")
id_txt = req_addcontrol("by Explosion Amount %", 'T',"")
id_type = req_addcontrol("", 'CH','Explode Implode')
id_cen = req_addcontrol("Center", 'v', 1)
id_rate = req_addcontrol("Explosion Amount (%)", 'n', 0)
id_rad = req_addcontrol("Effect Radius", 'n', 0)
call req_setval id_type, type
call req_setval id_rate, rate
call req_setval id_cen, cx cy cz, 0.0
call req_setval id_rad, rmax, 1.0
if (~req_post()) then do
call req_end
req=0
exit
end
rate=req_getval(id_rate)
parse value req_getval(id_cen) with cx cy cz .
rmax =req_getval(id_rad)
type =req_getval(id_type)
xform.1=(rate+100)/100
xform.2=abs(rate-100)/100
call req_end
if (open(state, filnam, 'W')) then do
call writeln state, version
call writeln state, rate cx cy cz rmax type
call close state
end
Pi=3.14159265358
DegreesPerRadian= 180/pi
/* Transform loop
*/
t=time('e')
n = xfrm_begin()
call meter_begin n+2 , "Exploding "n" Points," ," Be right with you."
do i = 1 to n
parse value xfrm_getpos(i) with x y z .
dx = x - cx
dy = y - cy
dz = z - cz
r = sqrt(dx * dx + dy * dy + dz * dz)
if (r ~= 0 & r<=rmax) then do
x = cx + dx * xform.type
y = cy + dy * xform.type
z = cz + dz * xform.type
call xfrm_setpos i, x y z
end
call meter_step
end
call meter_end
call xfrm_end
t=time('e')-t
say 'Whew, I just transformed 'n' points in only 't' seconds.'
call notify(1,'!Whew, I just transformed 'n' points','!in only 't' seconds.')
if (libadd) then call remlib("LWModelerARexx.port")
exit
syntax:
error:
call end_all
t=Notify(1,'!Rexx Script Error','@'ErrorText(rc),'Line 'SIGL)
if (libadd) then call remlib("LWModelerARexx.port")
exit